﻿using Simple.Common.Helpers;
using System;
using System.ComponentModel.DataAnnotations.Schema;

namespace Simple.Services;

/// <summary>
/// 学生
/// </summary>
public class QHSEMenuModel : ModelBase
{
    [MaxLength(32)]
    public string ParentId { get; set; }
    [MaxLength(32)]
    public string Id { get; set; }
    /// <summary>
    /// 编码
    /// </summary>
    [MaxLength(64)]
    public string? Code { get; set; }

    /// <summary>
    /// 名称
    /// </summary>
    [MaxLength(64)]
    public string? Name { get; set; } = "";

    /// <summary>
    /// 盐
    /// </summary>
    [MaxLength(32)]
    public string? Salt { get; set; }
    /// <summary>
    /// URL
    /// </summary>
    [MaxLength(256)]
    public string Url { get; set; }

    /// <summary>
    /// 菜单类型（1-目录，2-菜单，3-按钮）
    /// </summary>
    public MenuType Type { get; set; }

    /// <summary>
    /// 0显示，1隐藏
    /// </summary>
    public DataStatus Status { get; set; } = DataStatus.Display;

    /// <summary>
    /// 排序
    /// </summary>
    public int Sort { get; set; } = 99;

    public DateTime CreateTime { get; set; }
    public DateTime UpdateTime { get; set; }

    public override void ConfigureMapper(Profile profile)
    {
        profile.CreateMap<QHSESysMenu, QHSEMenuModel>()
            .ForMember(d => d.Id, options => options.MapFrom(s => s.Id));

        profile.CreateMap<QHSEMenuModel, QHSESysMenu>()
            .ForMember(d => d.Id, options => options.MapFrom(s => s.Id));
    }
}

